package utils.adapter;

import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.lanou.horo.myapplication.R;

import java.util.List;

import entity.ClassifoImgResult;

/**
 * Created by dllo on 15/11/25.
 */
public class ClassViewHolder02Adapter extends RecyclerView.Adapter<
        ClassViewHolder02Adapter.ViewHolder> {
private List<ClassifoImgResult.TagsEntity.ListEntity> tagListEntity;

    public void addFootItemData(List<ClassifoImgResult.TagsEntity.ListEntity> datas){
        this.tagListEntity = datas;
        Log.i("lanou","----->>"+datas.size());
        notifyDataSetChanged();
    }

    public class ViewHolder extends RecyclerView.ViewHolder {
        private TextView classifoimg_footer_item_text;
        public ViewHolder(View itemView) {
            super(itemView);
            classifoimg_footer_item_text = (TextView)itemView.findViewById(R.id.classifoimg_footer_item_text);
        }
    }
    @Override
    public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        LayoutInflater inflater = LayoutInflater.from(parent.getContext());
        View view = inflater.inflate(R.layout.classifoimg_footer_item, null);
        Log.i("lanou","--41--->>"+tagListEntity.size());
        return new ViewHolder(view);
    }

    @Override
    public void onBindViewHolder(ViewHolder holder, int position) {
        Log.i("lanou","-47---"+tagListEntity);
        if (tagListEntity != null) {
            ClassifoImgResult.TagsEntity.ListEntity liste = tagListEntity.get(position);
            if (liste != null) {
                holder.classifoimg_footer_item_text.setText(liste.getTname());
            }
        }

    }

    @Override
    public int getItemCount() {
        Log.i("lanou","--59--->>"+tagListEntity.size());
        return tagListEntity != null && tagListEntity.size() > 0 ?
                tagListEntity.size() : 0;
    }

}
